package com.wteam.dragon.model.pojo.bean;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.gitee.sunchenbin.mybatis.actable.annotation.*;
import com.gitee.sunchenbin.mybatis.actable.constants.MySqlTypeConstant;
import com.wteam.dragon.system.basebean.bean.BaseBean;
import lombok.Data;

import java.util.Objects;

/**
 * 岗位
 *
 * @Author 陈晓辉
 * @Date 2020/3/23
 */
@Data
@Table
@TableName
public class Job extends BaseBean {
    @IsKey
    @IsNotNull
    @IsAutoIncrement
    @TableId(type = IdType.AUTO)
    @ColumnType(MySqlTypeConstant.BIGINT)
    @Column(comment = "自增id")
    private Long id;

    @IsNotNull
    @ColumnType(MySqlTypeConstant.VARCHAR)
    @Column(comment = "岗位名称")
    private String name;

    @IsNotNull
    @DefaultValue("99999")
    @ColumnType(MySqlTypeConstant.BIGINT)
    @Column(comment = "排序")
    private Long sort;

    @IsNotNull
    @DefaultValue("1")
    @ColumnType(MySqlTypeConstant.BIGINT)
    @Column(comment = "是否禁用")
    private Boolean enabled;

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        Job job = (Job) o;
        return Objects.equals(id, job.id);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id);
    }
}